package cn.kgc.springmvc.controller;

import cn.kgc.springmvc.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author: mosin
 * @version: v1.0  2022/10/19
 */
@RestController
@RequestMapping("user")
public class UserController {

    @RequestMapping("t1")
    public Object test01(){
        System.out.println("UserController中test01被调用");
        return "hello";
    }


    @RequestMapping("login")
    public Object test02(HttpSession session){
        System.out.println("UserController用户登录的请求被调用");

        User user = new User();
        user.setAge(20);
        user.setName("tom");

        session.setAttribute("user", user);

        return "hello";
    }


    @RequestMapping("add")
    public Object test03(){
        System.out.println("UserController用户添加的请求被调用");
        return "hello";
    }
}
